package com.zscbw.test;

import java.lang.reflect.Method;

public class Method1 {
	private int f1(Object p, int x) throws NullPointerException {
		if (p == null) {
			throw new NullPointerException();
		}
		return x;
	}
	public static void main(String[] args) {
		try {
			Class cls = Class.forName("com.zscbw.test.Method1");
			Method methods[] = cls.getDeclaredMethods();
			for (int i = 0; i < methods.length ; i++) {
				Method m = methods[i];
				System.out.println("name : " + m.getName());
				System.out.println("decl class : " + m.getDeclaringClass());
				Class<?> pvec[] = m.getParameterTypes();
				for (int j = 0; j < pvec.length; j++) {
					System.out.println("param #" + j + " " + pvec[j]);
				}
				Class<?> evec[] = m.getExceptionTypes();
				for (int k = 0; k < evec.length ; k++) {
					System.out.println("exc #" + k + " " + evec[k]);
				}
				System.out.println("return type : " + m.getReturnType());
				System.out.println("---------------------!");
			}
		} catch (ClassNotFoundException e) {
			throw new RuntimeException(e);
		}
	}
}
